package com.yyfax.pay.depository.controller.api;

import javax.annotation.Resource;
import javax.validation.Valid;

import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import com.yyfax.framework.common.OpResponse;
import com.yyfax.pay.common.annotation.CheckSign;
import com.yyfax.pay.common.enums.FuiouDepositStateEnum;
import com.yyfax.pay.common.exception.PayExceptionCode;
import com.yyfax.pay.common.model.to.YYPayApiReq2;
import com.yyfax.pay.common.model.vo.ValidResult;
import com.yyfax.pay.depository.domain.FuiouUserRegister;
import com.yyfax.pay.depository.service.inner.FuiouChangeCardService;
import com.yyfax.pay.vo.depository.RspContent;
import com.yyfax.pay.vo.depository.UpdateBankCardReq;
import com.yyfax.pay.vo.depository.UserRegisterReq;

/**
 * 操作user_payment相关接口
 *
 * @author yejc
 * @date 2017-12-13
 * @since v1.0.0
 */
@RestController
public class UserPaymentApiController {

	@Resource
	private FuiouChangeCardService changeCardService;

	/**
	 * 更新user_payment相关银行卡信息,只更新富友存管支付通道的信息
	 *
	 * @author yejc
	 * @date 2017-12-13
	 * @since v2.0.2
	 * @param req
	 * @return
	 */
	@PostMapping("/api/user_payment/bank_card/update")
	@CheckSign
	public OpResponse normalUserRegister(@RequestBody @Valid YYPayApiReq2<UpdateBankCardReq> req) {
		UpdateBankCardReq params = req.getParams();
		changeCardService.updateUserPaymentBankCard(req.getMerchantCode(), params.getUserId(), params.getNewBankCardNo());
		return OpResponse.success();
	}
}
